package xu.zhi.qing.comment.dao;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import xu.zhi.qing.comment.entity.Comment;
import xu.zhi.qing.common.dao.BaseDao;

import java.util.List;
import java.util.Map;

@Repository
public interface CommentDao extends BaseDao<Comment> {
    /**
     * 根据分享id查找评论列表
     * @param shareId
     * @return
     */
    List<Comment> findByShareId(@Param("shareId")Integer shareId);

    /**
     * 查找评论的分享
     * @return
     */
    List<Map<String, Object>> findCommentByPage(Map<String,Object> params);

    Integer countCommentByPage(Map<String,Object> params);

    Integer collectCount(@Param("shareId")Integer shareId);

    Integer likeCount(@Param("shareId")Integer shareId);

    Integer commentCount(@Param("shareId")Integer shareId);

    List<Comment> findByUserId(@Param("userId")Integer userId);

    Integer countByUserId(@Param("userId")Integer userId);

    List<Comment> findById(@Param("id")Integer id);

    List<Comment> findByParentId(@Param("id")Integer id);

    Integer countByShareId(@Param("shareId")Integer shareId);

    void deleteByShareId(@Param("shareId")Integer shareId);
}
